<!--<div ng-if="!tab.loading" ng-init="resultContainer=tab.results[0]">-->
<div  ng-controller="RenderCtrl as render" ng-repeat="resultContainer in tab.results">
<!--<md-tab ng-repeat="resultContainer in tab.results" md-dynamic1-height md-border-bottom class="h100">-->
    <!-- ------------------------------------  -->

    <md-tabs md-dynamic-height  md-border-bottom md-autoselect md-selected="tab.selectedTabResultIndex" ng-init="initTableTab()">

        <!-- ---------- ! TOOLBAR + RESULT MENU ! -------------  -->

        <span ng-if="resultContainer.cellsCalc">{{resultContainer.cellsCalc}}</span>

        <md-menu md-position-mode="target" ng-repeat="tableData in ::resultContainer.widgets.tables"
                 ng-if="::tableData.data.progressQuery">
            <md-button aria-label="menu" class="md-icon-button tabs-buttons" ng-click="$mdOpenMenu($event)">
                <md-tooltip>{{::tableData.data.progressQuery}}</md-tooltip>
                <i class="mdi mdi-18px mdi-file-excel"></i>
            </md-button>
            <md-menu-content>
                <md-menu-item>
                    <md-button
                            ng-csv="getExportData(tableData)"
                            quote-strings='"'
                            filename="{{::tab.name}}-{{::result.time}}.csv"
                            csv-header="getExportHeaders(tableData)"
                    >
                        CSV with headers
                    </md-button>
                </md-menu-item>
                <md-menu-item>
                    <md-button
                            ng-csv="getExportData(tableData)"
                            quote-strings='"'
                            filename="{{::tab.name}}-{{::result.time}}.csv"
                    >
                        CSV without headers
                    </md-button>
                </md-menu-item>
                <md-menu-item>
                    <md-button
                            ng-csv="getExportData(tableData)"
                            quote-strings=''
                            filename="{{::tab.name}}-{{::result.time}}.txt"
                            field-separator="\t"
                            csv-header="getExportHeaders(tableData)"
                    >
                        TSV with headers
                    </md-button>
                </md-menu-item>
                <md-menu-item>
                    <md-button
                            ng-csv="getExportData(tableData)"
                            quote-strings=" "
                            filename="{{::tab.name}}-{{::result.time}}.txt"
                            field-separator="\t"
                            csv-header="getExportHeaders(tableData)"
                    >
                        TSV without headers
                    </md-button>
                </md-menu-item>
            </md-menu-content>
        </md-menu>





        <!--<md-menu md-position-mode="target" ng-repeat="tableData in ::resultContainer.widgets.tables"-->
                 <!--ng-if="::tableData.data.progressQuery">-->
            <!--<md-button aria-label="menu" class="md-icon-button tabs-buttons" ng-click="$mdOpenMenu($event)">-->
                <!--<md-tooltip>{{::tableData.data.progressQuery}}</md-tooltip>-->
                <!--<i class="mdi mdi-18px mdi-bank"></i>-->
            <!--</md-button>-->
            <!--<md-menu-content>-->
                <!--<md-menu-item>-->
                    <!--<md-button ng-click="SendToDashboard(tableData,'table')">-->
                        <!--Table to Dashboard-->
                    <!--</md-button>-->
                <!--</md-menu-item>-->
                <!--<md-menu-item>-->
                    <!--<md-button ng-click="SendToDashboard(tableData,'chart')">-->
                        <!--Chart to Dashboard-->
                    <!--</md-button>-->
                <!--</md-menu-item>-->

            <!--</md-menu-content>-->
        <!--</md-menu>-->





            <md-button aria-label="menu" class="md-icon-button tabs-buttons">
                <i class="mdi mdi-18px " ng-class="vars.staticGrid ? 'mdi-pin' : 'mdi-pin-off'" ng-click="switchStaticGrid()"></i>
                <md-tooltip>Pinned</md-tooltip>
            </md-button>

            <!--<md-button aria-label="menu" class="md-icon-button tabs-buttons">-->
                <!--<i class="mdi mdi-18px mdi-share-variant" ng-click="shareResult()"></i>-->
                <!--<md-tooltip>Share</md-tooltip>-->
            <!--</md-button>-->

        <!--<md-button aria-label="menu" class="md-icon-button tabs-buttons" ng-repeat="wplotly in ::resultContainer.widgets.draw" ng-if="vars.active.draw">-->
        <!--<i class="mdi mdi-18px mdi-chart-bar" ng-click="openEditorPlotLy(wplotly)"></i>-->
        <!--<md-tooltip>Edit Plotly chart</md-tooltip>-->
        <!--</md-button>-->
            <!--<md-button aria-label="menu" class="md-icon-button tabs-buttons">-->
                <!--<i class="mdi mdi-18px mdi-settings" ng-click="switchStaticGrid()"></i>-->
                <!--<md-tooltip>Settings</md-tooltip>-->
            <!--</md-button>-->

            <!--<md-button aria-label="menu" class="md-icon-button tabs-buttons">-->
                    <!--<i class="mdi mdi-18px mdi-upload" ng-click="showDialogUpload(resultContainer.widgets)"></i>-->
                    <!--<md-tooltip>Upload CSV</md-tooltip>-->
            <!--</md-button>-->

        <!-- ------------------------------------  -->
        <!-- !TABLES! -->
        <md-tab md-on-select="vars.active.table=true" ng-click="">
            <md-tab-label>
                Table <i class="mdi mdi-18px mdi-table-large"></i>
            </md-tab-label>

            <md-tab-body>
                <div ng-init="widgets = resultContainer.widgets.tables" ng-include="'app/render/WidgetsList.html'" ng-if="vars.active.table"></div>
            </md-tab-body>
        </md-tab>

        <!-- ------------------------------------  -->
        <!-- !CHART! -->
        <md-tab md-on-select="vars.active.draw=true" >
            <md-tab-label>
                Draw <i class="mdi mdi-18px mdi-chart-bar"></i>
            </md-tab-label>
            <md-tab-body>
                <div ng-init="widgets = resultContainer.widgets.draw" ng-include="'app/render/WidgetsList.html'" ng-if="vars.active.draw"></div>
            </md-tab-body>
        </md-tab>

        <!-- ------------------------------------  -->
        <!--&lt;!&ndash; !PIVOTJS! &ndash;&gt;-->
        <!--<md-tab md-on-select="vars.active.pivot=true">-->
            <!--<md-tab-label>-->
                <!--Pivot  <i class="mdi mdi-18px mdi-palette-advanced"></i>-->
            <!--</md-tab-label>-->
            <!--<md-tab-body >-->
                <!--<div ng-init="widgets = resultContainer.widgets.pivot" ng-include="'app/render/WidgetsList.html'" ng-if="vars.active.pivot"></div>-->
            <!--</md-tab-body>-->
        <!--</md-tab>-->


        <!-- ------------------------------------  -->
        <!--&lt;!&ndash; !STATS! &ndash;&gt;-->
        <!--<md-tab md-on-select="vars.active.stats=true">-->
            <!--<md-tab-label>-->
                <!--Stats <i class="mdi mdi-18px mdi-school"></i>-->
            <!--</md-tab-label>-->
            <!--<md-tab-body>-->
                <!--<div ng-init="widgets = resultContainer.widgets.stats" ng-include="'app/render/WidgetsList.html'"-->
                     <!--ng-if="vars.active.stats"></div>-->
            <!--</md-tab-body>-->
        <!--</md-tab>-->
    </md-tabs>
</div>




